package io.fft.flight.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author: likailun
 * @Description: 乘客类型
 * @Date: create in 2024/8/5 21:51
 */
@Getter
@AllArgsConstructor
public enum PassengerTypeEnum implements BaseEnum<Integer> {

    ADULT(1, "成人"),
    CHILDREN(2, "儿童"),
    BABY(3, "婴儿");

    private final Integer code;
    private final String message;

    public static Optional<PassengerTypeEnum> getByCode(Integer code) {
        return Arrays.stream(PassengerTypeEnum.values()).filter(item -> item.getCode().equals(code)).findAny();
    }
}
